package stock;

import java.util.Iterator;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.web.reactive.function.client.WebClient;

import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import reactor.netty.http.client.HttpClient;

public class TestCls {

	public static void main(String[] args) throws InterruptedException {

		// 创建WebClient实例，指定信任所有SSL/TLS证书的工厂
		String url = "https://www.cls.cn/hotPlate";

		// 指定Chrome浏览器核心
		System.setProperty("webdriver.chrome.driver", "D:\\chromedriver\\chromedriver.exe");

		// 创建Chrome浏览器驱动
		// 配置Chrome选项
		ChromeOptions options = new ChromeOptions();
		//options.addArguments("--headless"); // 无界面运行

		// 创建Chrome浏览器驱动
		WebDriver driver = new ChromeDriver(options);
		driver.get(url);
		// WebDriverWait wait = new WebDriverWait(driver, 2000);
		// driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
		// 抓取网页内容
		// String pageContent = driver.getPageSource();

		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
			   List<WebElement> elements = driver.findElements(By.xpath("//div[@class='clearfix w-100p f-s-14 c-747474 toggle-nav-box finance-toggle-nav']//div")); 

	        // 定位 <a> 链接
		      
	        
	         System.out.println("div=="+elements.size());
	         
	         elements.get(1).click();
	         Thread.sleep(1500);
	         
	         List<WebElement> elements1 = driver.findElements(By.xpath("//tr[@class='f-s-14 c-383838']"));
	         
	        // System.out.println(elements1.size());
	         
	         for (int i = 0; i < elements1.size(); i++) {
			//	System.out.println(elements1.get(i).getText()); 
			}
	         
	         
	         
	        
	         
		 

	}
	
	 

}
